﻿<!DOCTYPE html>

<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
    <meta charset="utf-8" />
    <title>数字转大写 - 在线工具 - 迷糊虫的工具箱</title>
    <link rel="shortcut icon" href="/tools/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui-v2.5.6/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="/tools/static/css/fly/global.css" />
    <link rel="stylesheet" type="text/css" href="/tools/static/css/global.css" />
    <style>
        .fly-extend-list-desc {
            height: auto;
        }
    </style>
</head>
<body>
    <div class="layui-header header header-extends" style="background-color: #24262F;">
        <div class="layui-container">
            <a class="fly-logo" href="/tools">迷糊虫的工具箱</a>
            <div class="layui-form component" lay-filter="LAY-site-header-component">

            </div>
            <ul class="layui-nav tools-nav" lay-filter="tools-nav">
            </ul>
        </div>
    </div>
    <div class="fly-extend-detail layui-card">
        <div class="layui-container">
            <div class="fly-extend-list-header">
                <h1 class="fly-extend-title layui-elip"><a>文字加密解密</a><span class="layui-badge layui-bg-green layui-hide-xs">金额/汉字</span></h1>
            </div>
            <div class="fly-extend-list-desc">
                Base64、Url、MD5
            </div>
            <div class="layui-btn-container layui-extend-doc-edit">
            </div>
        </div>
    </div>
    <div class="layui-container">
        <div class="layui-form" style="margin-bottom: 15px;">
            <div class="layui-card">
                <div class="layui-card-header">文字</div>
                <div class="layui-card-body">
                    <textarea id="result" class="layui-textarea" placeholder="文字"></textarea>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-body layui-btn-container btn-container" style="padding-bottom:0px;">
                    <input type="button" class="layui-btn" data-type="base64_encode" value="Base64 Encode" />
                    <input type="button" class="layui-btn" data-type="base64_decode" value="Base64 Decode" />
                    <input type="button" class="layui-btn layui-btn-normal" data-type="url_encode" value="Url Encode" />
                    <input type="button" class="layui-btn layui-btn-normal" data-type="url_decode" value="Url Decode" />
                    <!--<div class="layui-inline">
                        <ul class="layui-nav layui-tabs-btn-select layui-btn-danger" lay-filter="layui-tabs-select">
                            <li class="layui-nav-item" lay-unselect>
                                <a href="javascript:;">MD5</a>
                                <dl class="layui-nav-child layui-anim layui-anim-upbit">
                                    <dd lay-unselect class="tools-btn" data-type="md5_16"><a href="javascript:;">16位</a></dd>
                                    <dd lay-unselect class="tools-btn" data-type="md5_32"><a href="javascript:;">32位</a></dd>
                                </dl>
                            </li>
                        </ul>
                    </div>-->
                    <input type="button" class="layui-btn" data-type="md5" value="MD5" />
                    <input type="button" class="layui-btn layui-btn-danger" data-type="empty" value="清空" />
                    <input type="button" class="Copy layui-btn layui-btn-warm" data-clipboard-target="#result" value="复制" />
                </div>
            </div>
        </div>
    </div>
    <script src="/tools/static/js/jquery/jquery.min.js"></script>
    <script src="https://www.layuicdn.com/layui-v2.5.6/layui.js"></script>
    <script src="/tools/static/js/clipboard/clipboard.min.js"></script>
    <script src="./static/js/jquery.base64.js"></script>
    <script src="./static/js/md5.js"></script>
    <script src="/tools/static/js/main.js"></script>
    <script src="./static/js/main.js"></script>
    <script>
        layui.use(['element', 'form'], function () {
            var element = layui.element,
                form = layui.form;
            var clipboard = new ClipboardJS('.Copy');
            clipboard.on('success', function (e) {
                layer.msg("复制成功", { icon: 6 }); //需引入 layui
            });
            clipboard.on('error', function (e) {
                layer.msg("复制失败", { icon: 5 }); ////需引入 layui
            });
            $('.btn-container .layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
            $('.btn-container .tools-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
            var active = {
                empty: function () {
                    $("#result").val('')
                },
                base64_encode: function () {
                    var result = $('#result').val();
                    if (result) {
                        $('#result').val($.base64.encode(result))
                    } else {
                        layui.layer.msg("请填写内容", { icon: 5 });
                    }
                },
                base64_decode: function () {
                    var result = $('#result').val();
                    if (result) {
                        $('#result').val($.base64.decode(result))
                    } else {
                        layui.layer.msg("请填写内容", { icon: 5 });
                    }
                },
                url_encode: function () {
                    var result = $('#result').val();
                    if (result) {
                        $('#result').val(encodeURIComponent(result))
                    } else {
                        layui.layer.msg("请填写内容", { icon: 5 });
                    }
                },
                url_decode: function () {
                    var result = $('#result').val();
                    if (result) {
                        $('#result').val(decodeURIComponent(result))
                    } else {
                        layui.layer.msg("请填写内容", { icon: 5 });
                    }
                },
                md5: function () {
                    var result = $('#result').val();
                    if (result) {
                        $('#result').val(CryptoJS.MD5(result))
                    } else {
                        layui.layer.msg("请填写内容", { icon: 5 });
                    }
                },
                md5_16: function () {
                    var result = $('#result').val();
                    if (result) {
                        $('#result').val(CryptoJS.MD5(result, 16))
                    } else {
                        layui.layer.msg("请填写内容", { icon: 5 });
                    }
                },
                md5_32: function () {
                    var result = $('#result').val();
                    if (result) {
                        $('#result').val(CryptoJS.MD5(result, 32))
                    } else {
                        layui.layer.msg("请填写内容", { icon: 5 });
                    }
                }
            }
            form.on('submit(*)', function (data) {
                var char = Arabia_to_Chinese(data.field.number)
                $('#result').val(char)
                return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
            });
        })
    </script>
</body>
</html>
